package com.example.demo.controller;

import com.example.demo.entity.Person;
import com.example.demo.entity.Shop;
import com.example.demo.mapper.ShopMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/shop")
public class ShopController {

    @Autowired
    private ShopMapper shopMapper;

    @GetMapping("/getShopList")
    public List query(){
        List<Shop> list = shopMapper.selectList(null);
        return list;
    }

    @PostMapping("/insertShop")
    public int insert(Shop shop){
        return shopMapper.insert(shop);
    }

    @PostMapping("/shopDeleteById")
    public int deleteById(Long id){
        return shopMapper.deleteById(id);
    }

    @PostMapping("/shopSelectByIds")
    public Shop selectById(Integer id){
        return shopMapper.selectById(id);
    }

    @PostMapping("/shopUpdate")
    public int selectById(Shop shop){
        return shopMapper.updateById(shop);
    }
}
